package com.artpri.dao.impl;

import java.util.List;

import com.artpri.dao.CollectShopkeeperDao;
import com.artpri.model.CollectShopkeeper;

/**
 * 
 * @author ZhangSi
 *
 */
public class CollectShopkeeperDaoImpl extends HibernateDaoImpl<CollectShopkeeper> implements CollectShopkeeperDao{

	@Override
	public List<CollectShopkeeper> findByUser(Integer userNum) {
		return find("from CollectShopkeeper c where c.userNum=?0", userNum);
	}
	
	@Override
	public List<CollectShopkeeper> findByUser(Integer userNum, int pageNo, int pageSize) {
		return findByPage("from CollectShopkeeper c where c.userNum=?0", pageNo, pageSize, userNum);
	}

	@Override
	public void delete(List<Integer> ids) {
		Object[][] params = new Object[ids.size()][1];
		
		for(int i = 0; i < ids.size(); i++) {
			Object[] param = new Object[]{ids.get(i)};
			params[i] = param;
		}
		
		updateBatch("delete from collect_shopkeeper where cs_id=?", params);
	}

}
